<%-- 
    Document   : view_akademikList
    Created on : Jan 19, 2014, 4:00:04 AM
    Author     : Muhammad Dony
--%>

<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="data.IdentitasData"%>
<%@page import="data.AkademikData"%>
<%@page import="database.IdentitasDB"%>
<%@include file="../Admin/header_admin.jsp" %>
<% //userdata user = (userdata) session.getAttribute("adminMasuk"); %>
<script src="res/js/jquery.dataTables.js"></script>
<script src="res/js/bootstrap.dataTables.js"></script>
<link href="res/css/dataTables.css" type="text/css"/>
<style>.pagination{margin:0}</style>
<div class="row">
    
    <div class="col-lg-7 col-lg-push-1">
        <h2 align="center">Rekap Laporan Akademik Beasiswa Unggulan CIMB Niaga</h2>
            <form action="Rekap_akademik" role="form" method="POST" parsley-validate>
                <div>
                    <label>Urut Berdasarkan</label>
                    <select name="urutan" id="urutan" onchange="view();">  
                        <option value="Seluruhnya"> Seluruh Penerima Beasiswa </option>
                        <option value="Aktif"> Seluruh Angkatan Aktif </option>
                        <option value="angkatan"> Angkatan </option>
                        <option value="universitas"> Universitas </option>
                    </select>
                    <select name="batch" id="batch" hidden>  
                        <option value="2007" > 2007 </option>
                        <option value="2008" > 2008 </option>
                    </select>
                    <select name="universitas" id="universitas" hidden>  
                        <option value="UI" > Universitas Indonesia </option>
                        <option value="ITB" > Institut Teknologi Bandung </option>
                    </select>
                    <input type="submit" value="pilih">
                </div>
                <script type="text/javascript">
                    function view()
                    {
                        if (document.getElementById('urutan').value=='angkatan') {
                            document.getElementById('batch').hidden=false;
                            document.getElementById('universitas').hidden=true;
                        } else if (document.getElementById('urutan').value=='universitas') {
                            document.getElementById('universitas').hidden=false;
                            document.getElementById('batch').hidden=true;
                        } else {
                            document.getElementById('batch').hidden=true;
                            document.getElementById('universitas').hidden=true;
                        }
                    }
                </script>
            </form>
        <h4>Daftar Penerima Beasiswa</h4>
        <table id="table" cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered">
            <thead>
            <th>No</th>
            <th>Nama Lengkap</th>
            <th>Universitas</th>
            <th>Semester</th>
            <th>IPK</th>
            </thead>
            <tbody>
                <%
                    List listidentitas = (List) request.getAttribute("listidentitas");
                    List listakademik = (List) request.getAttribute("listakademik");
                    
                    int n = 1;
                    
                     for (int i = 0; i < listidentitas.size(); i++) {
                        IdentitasData identitas = (IdentitasData) listidentitas.get(i);
                        List listakademik1 = new ArrayList();
                        String IPK= "", Semester = "";
                        for (int j = 0; j< listakademik.size(); j++) {
                            
                            AkademikData akademik = (AkademikData) listakademik.get(j);
                            if(identitas.getID().equals(akademik.getID())){
                            Semester = akademik.getSemester();
                            IPK = akademik.getIPK();
                             }
                        }

                        
                %>
                <tr>
                    <td><%=n++%></td>
                    <td><%=identitas.getNama1()%></td>
                    <td><%=identitas.getUniversitas()%></td>
                    <td><%=Semester%></td>
                    <td><%=IPK%></td>
                    <td>
                        <a href="./Rekap_akademik?action=view&id=<%=identitas.getID()%>" class="btn btn-primary">
                            <i class="glyphicon glyphicon-pencil"></i> View
                        </a>
                    </td>  
                </tr>
                <%         
                    }%>
            </tbody>
        </table>
            <a href="./Rekap_akademik?action=rekap" class="btn btn-primary">
                            <i class="glyphicon glyphicon-pencil"></i> Download Excel
                        </a>
    </div>
</div>
<%@include file="../Admin/footer_admin.jsp" %>